|
|
|
|
|
|
|
Most chapters in the Internet portion of this book focus on how you can use Visual Basic to take Web pages beyond standard HTML. Although Web pages might be the most popular way to use the Internet, you can do a lot more with Visual Basic and the Internet, such as the following: |
|
|
|
|
|
|
|
|
Integrate the Web browser into your application |
|
|
|
|
|
|
|
|
Send and receive e-mail messages |
|
|
|
|
|
|
|
|
Transfer files with the Internet Transfer Control |
|
|
|
|
|
|
|
|
Although this list in no way exhausts the ways you can use Visual Basic with the Internet, these topics are relevant and useful to many developers. This chapter provides a practical introduction to each of the topics. |
|
|
|
|
|
|
|
|
Adding Browser Functionality to Your Application |
|
|
|
|
|
|
|
|
Often you might want to integrate Internet browsing into an otherwise standard Visual Basic program. For example, you might provide a list of links to documentation and other support Web pages. By adding just a few lines of code, you can have your application automatically launch the user's browser and open the correct page. You can also add a browser control to your application, which allows the user to peruse Web pages inside a window contained on a Visual Basic form. Either method provides an easy way to use the functionality of a Web browser in your VB applications. |
|
|
|
|
|
|
|
|
Creating a Browser on a Form |
|
|
|
|
|
|
|
|
The simplest way to add the contents of a Web site to your application is to use the WebBrowser control, which is installed with Internet Explorer 4.0. First, add the control to a Standard EXE project by choosing Components from the Project menu and selecting Microsoft Internet Controls. Next, draw a WebBrowser control on a form at the size you want. |
|
|
|
|
|
|
|
|
To make the WebBrowser control work, you only need to write a single line of code, as in the following example: |
|
|
|
|
|
|
|
|
WebBrowser1.Navigate "http://www.quecorp.com/" |
|
|
|
|
|
|
|
|
The WebBrowser control's Navigate method causes the WebBrowser control to connect to the specified URL and retrieve a Web page, as shown in Figure 33.1. |
|
|
|
|
|
|
|
|
Because the WebBrowser is a control inside your Visual Basic program, it does not automatically contain all of the toolbars and other controls associated with Microsoft Internet Explorer. However, you can easily add your own command buttons or custom functions to make the WebBrowser control navigate to the sites you want. |
|
|
|
|
|